package main

import "fmt"

func main()  {
	//input:=[]int{1,0,1,0,1}
	//a := 2
	input:=[]int{0,0,0,0,0}
	a := 0
	output:=numSubarraysWithSum(input,a)
	fmt.Println(output)
}

func numSubarraysWithSum(nums []int, goal int) int {
	count := 0
	n := len(nums)
	for i:=0;i<n;i++{
		obj:=goal-nums[i]
		if obj==0{
			count++
		}
		if obj<0{
			continue
		}
		for j:=i+1;j<n;j++{
			obj = obj-nums[j]
			if obj<0{
				break
			}
			if obj==0{
				count++
			}
		}
		fmt.Println(count)
	}

	return count
}
